﻿using System;
using Plugins;
using SMAPlugin.Common;
using SMAPlugin.Historical;
using StockModel;
using Utils;
using StockAccessors;
using System.Windows.Media.Imaging;

[assembly: PluginContainerAssembly]

namespace SMAPlugin
{
	public class SMAPlugin : Plugins.Base.PluginBase
	{
		#region Properties

		public override bool SupportsRealtime
		{
			get
			{
				return false;
			}
		}

		#endregion

		#region Public Methods

		public SMAPlugin()
		{
			base.VisualRepresentation = new VisualRepresentation(new BitmapImage(new Uri(@"pack://application:,,,/SMAPlugin;component/Resources/ToolBar.ico")), "SMA Strategy");
		}

		public override void Initialize(SqlDataBaseClient databaseClient, QuotationDataSource quotationDataSource, ExchangeMarketDataSource exchangeMarketDataSource, RawStockDataSource rawStockDataSource, ObservableCollection2<StockGroup> realtimeGroups, IOrderExecutor executor, IStockDataAccessorInformation accessorInformation)
		{
			DecisionEngineData historicalEngineData = new DecisionEngineData();

			base.HistoricalEngine = new HistoricalEngine(quotationDataSource, rawStockDataSource, historicalEngineData);
			base.HistoricalControlPanel = new ControlPanel() { DataContext = new ControlPanelVM(rawStockDataSource, (HistoricalEngine)base.HistoricalEngine) };
		}

		#endregion
	}
}
